package com.zkingsoft.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zkingsoft.dao.AdvertisementColumnDao;
import com.zkingsoft.dao.AdvertisementPositionDao;
import com.zkingsoft.model.AdvertisementColumn;
import com.zkingsoft.model.AdvertisementPosition;
import com.zkingsoft.plugin.pojo.PaginationVO;
import com.zkingsoft.services.AdvertisementColumnService;
import com.zkingsoft.services.AdvertisementPositionService;

/**
 * This field was generated by Zking.software.Codegen.
 * @date 2016-07-15 11:19
 */
@Service("advertisementPositionService")
public class  AdvertisementPositionServiceImpl implements    AdvertisementPositionService  {

	
	@Autowired
	private AdvertisementPositionDao advertisementPositionDao;
	
	@Autowired
	private AdvertisementColumnDao adColumnDao;
	
	@Override
	public int add(AdvertisementPosition advertisementPosition){
		
		return advertisementPositionDao.insert(advertisementPosition);
		
	}
   	
    @Override
	public int modify(AdvertisementPosition advertisementPosition){
	
		return advertisementPositionDao.update(advertisementPosition);
	
	}
	
	@Override
	public int remove(List<Long> list){
	
		return advertisementPositionDao.deleteByIds(list);
	
	}

	@Override
	public int removeById(Long id){
	
		return advertisementPositionDao.deleteById(id);
	
	}
	
	@Override
	public List<AdvertisementPosition> findInPage(AdvertisementPosition advertisementPosition,  PaginationVO pageVo){
	
		return advertisementPositionDao.selectInPage(advertisementPosition , pageVo);
	
	}
	
	@Override
	public List<AdvertisementPosition> findByModel(AdvertisementPosition advertisementPosition){
	
		return advertisementPositionDao.selectByModel(advertisementPosition);
	
	}
	
	public List<AdvertisementPosition> findByColumnId(Long columnId,Integer key){
		return advertisementPositionDao.selectByColumnId(columnId,key);
	}
	
	@Override
	public int  findTotal(AdvertisementPosition advertisementPosition){
	
		return advertisementPositionDao.selectTotalRecord(advertisementPosition);
	
	}
	
	@Override
	public AdvertisementPosition  findById(Long id){
	
		return advertisementPositionDao.selectById(id);
	
	}
	
	@Override
	public List<AdvertisementPosition> findPointByCloumName(String cloumName) {
		AdvertisementColumn advertisementColumn=new AdvertisementColumn();
		advertisementColumn.setColumnName(cloumName);
		advertisementColumn=adColumnDao.selectByModel(advertisementColumn).get(0);
		return advertisementPositionDao.selectPointByCloumName(cloumName,advertisementColumn.getCapacity());
	}
	
	
	
	
	

   	
	
	
}